<template>
    <div class="menu">
        <div class="menu-item mr-16" @click="goControl" v-if="isLoggedIn">控制台</div>
        <div class="menu-item mr-32" @click="router.push('/login')" v-if="!isLoggedIn">登录</div>
        <div class="menu-item" v-if="!isLoggedIn" @click="router.push({ path: '/login', query: { type: 'register' } })"><img src="@/assets/img/console/register.png" alt=""></div>
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import dbUtils from 'libs/util.strotage.js'
const isLoggedIn = dbUtils.get('token')

const router = useRouter()

function goControl() {
    router.push('/personalSpace')
}
</script>

<style lang="scss" scoped>
.menu {
    display: flex;
    background-color: transparent;
    padding-right: 60px;
}

.menu-item {
    color: #FFF;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    cursor: pointer;
}
</style>

